package com.ly.pic.init;

import com.ly.pic.service.FeatureExtractionAGG19Service;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.ops.transforms.Transforms;

import java.io.IOException;

public class Main {

    public static void main(String[] args) throws IOException {
        FeatureExtractionAGG19Service featureExtraction = new FeatureExtractionAGG19Service();

        String imagePath1 = "C:\\Users\\ly\\Desktop\\resuouce\\pic-match\\004 - copy.png";
        String imagePath2 = "C:\\Users\\ly\\Desktop\\resuouce\\pic-match\\004 - copy.png";

        INDArray features1 = featureExtraction.extractFeatures(imagePath1);
        INDArray features2 = featureExtraction.extractFeatures(imagePath2);


        long l = System.currentTimeMillis();
        double similarity = Transforms.cosineSim(features1, features2);
        System.out.println(System.currentTimeMillis() - l);
        System.out.println("Cosine Similarity: " + similarity);
    }
}
